<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
  export default {
    mounted () {
      let that = this
      that.backButtonListen()
    },
    methods: {
      // android后退按钮监听
      backButtonListen () {
        let that = this
        that.$nextTick(() => {
          document.addEventListener('backbutton', () => {
            let isCanQuit = that.$route.meta.isCanQuit
            if (isCanQuit) {
              if (that.$store.getters.isQuitApp) {
                navigator.app.exitApp()
                return
              }
              that.$store.dispatch('setLastTimeClickQuit', new Date().getTime())
//              that.$vux.toast.text('再次点击退出应用', 'bottom')
            } else {
              that.$router.back()
            }
          }, false)
        })
      }
    }
  }
</script>

<style lang="less">
  @import 'assets/css/appCommon.less';

  html, body {
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  }
</style>
